---
id: HMR
title: HMR
---

## Hot Module Replacement
用于在应用程序运行过程中，替换、添加或删除模块，而无需重新加载整个页面或应用程序。
```js
// webpack.config.js
+ const webpack = require('webpack');

module.exports = {
    mode: 'development',
    entry: {
      app: './src/index.js',
    },
    devtool: 'inline-source-map',
    devServer: {
      contentBase: './dist',
+     hot:true, // 开启热模块更新
   },
   plugins: [
+     new webpack.HotModuleReplacementPlugin()
    ],
}

```
